

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Utility Component &mdash; MNMLSTC Core 1.1 documentation</title>
  

  
  

  
  <link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  
    <link rel="top" title="MNMLSTC Core 1.1 documentation" href="index.html"/>
        <link rel="next" title="Memory Component" href="memory.html"/>
        <link rel="prev" title="Variant Component" href="variant.html"/> 

  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-nav-search">
        <a href="index.html" class="fa fa-home"> MNMLSTC Core</a>
        <div role="search">
  <form id ="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
      </div>

      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
        
        
            <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="usage.html">Using MNMLSTC Core</a><ul>
<li class="toctree-l2"><a class="reference internal" href="usage.html#library-layout">Library Layout</a></li>
<li class="toctree-l2"><a class="reference internal" href="usage.html#feature-addition-and-deprecation">Feature Addition and Deprecation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="type-traits.html">Type Traits</a></li>
<li class="toctree-l1"><a class="reference internal" href="functional.html">Functional Utilities</a></li>
<li class="toctree-l1"><a class="reference internal" href="algorithm.html">Algorithms</a><ul>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#non-modifying-sequence-operations">Non-Modifying Sequence Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#modifying-sequence-operations">Modifying Sequence Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#partitioning-operations">Partitioning Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#sorting-operations">Sorting Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#binary-search-operations">Binary Search Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#set-operations">Set Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#heap-operations">Heap Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#min-max-operations">Min/Max Operations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="iterator.html">Iterator Utilities</a></li>
<li class="toctree-l1"><a class="reference internal" href="optional.html">Optional Types</a><ul>
<li class="toctree-l2"><a class="reference internal" href="optional.html#optional-type">Optional Type</a></li>
<li class="toctree-l2"><a class="reference internal" href="optional.html#expected-type">Expected Type</a></li>
<li class="toctree-l2"><a class="reference internal" href="optional.html#result-type">Result Type</a></li>
<li class="toctree-l2"><a class="reference internal" href="optional.html#functions">Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="optional.html#specializations">Specializations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="numeric.html">Numeric Algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="variant.html">Variant Type</a><ul>
<li class="toctree-l2"><a class="reference internal" href="variant.html#specializations">Specializations</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Uncategorized Utilities</a></li>
<li class="toctree-l1"><a class="reference internal" href="memory.html">Memory</a><ul>
<li class="toctree-l2"><a class="reference internal" href="memory.html#polymorphic-smart-pointer">Polymorphic Smart Pointer</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#deep-copying-smart-pointer">Deep Copying Smart Pointer</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#dumbest-smart-pointer">Dumbest Smart Pointer</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#utilities">Utilities</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#comparison-operators">Comparison Operators</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#make-functions">Make Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#specializations">Specializations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="string.html">String Utilities</a><ul>
<li class="toctree-l2"><a class="reference internal" href="string.html#specializations">Specializations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="range.html">Range Type</a><ul>
<li class="toctree-l2"><a class="reference internal" href="range.html#specialization">Specialization</a></li>
<li class="toctree-l2"><a class="reference internal" href="range.html#answers-to-open-questions">Answers to Open Questions</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="any.html">Any Type</a></li>
</ul>

        
      </div>
      &nbsp;
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="index.html">MNMLSTC Core</a>
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="index.html">Docs</a> &raquo;</li>
      
    <li>Utility Component</li>
      <li class="wy-breadcrumbs-aside">
        
          <a href="_sources/utility.txt" rel="nofollow"> View page source</a>
        
      </li>
  </ul>
  <hr/>
</div>
          <div role="main">
            
  <div class="section" id="utility-component">
<span id="core-utility-component"></span><h1>Utility Component<a class="headerlink" href="#utility-component" title="Permalink to this headline">¶</a></h1>
<p>The utility component provides additional functions and meta templates that
cannot be categorized. Most of the utilities provided are for working with
type lists.</p>
<dl class="class">
<dt id="integer_sequence:T.Is:">
<em class="property">class </em><tt class="descname">integer_sequence&lt;T, Is&gt;</tt><a class="headerlink" href="#integer_sequence:T.Is:" title="Permalink to this definition">¶</a></dt>
<dd><p>meta template to generate a series of <em>T</em> to allow easier unpacking.</p>
</dd></dl>

<dl class="class">
<dt id="index_sequence:I:">
<em class="property">class </em><tt class="descname">index_sequence&lt;I&gt;</tt><a class="headerlink" href="#index_sequence:I:" title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <a class="reference internal" href="#integer_sequence:T.Is:" title="integer_sequence&lt;T, Is&gt;"><tt class="xref cpp cpp-class docutils literal"><span class="pre">integer_sequence&lt;T,</span> <span class="pre">Is&gt;</span></tt></a>.</p>
</dd></dl>

<dl class="class">
<dt id="make_index_sequence:N:">
<em class="property">class </em><tt class="descname">make_index_sequence&lt;N&gt;</tt><a class="headerlink" href="#make_index_sequence:N:" title="Permalink to this definition">¶</a></dt>
<dd><p>Used to generate the <a class="reference internal" href="#index_sequence:I:" title="index_sequence&lt;I&gt;"><tt class="xref cpp cpp-class docutils literal"><span class="pre">index_sequence&lt;I&gt;</span></tt></a>, with <em>N</em> numbers.</p>
</dd></dl>

<dl class="class">
<dt id="typelist_index:T.Ts:">
<em class="property">class </em><tt class="descname">typelist_index&lt;T, Ts&gt;</tt><a class="headerlink" href="#typelist_index:T.Ts:" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Inherits:</th><td class="field-body"><tt class="docutils literal"><span class="pre">std::integral_constant&lt;std::size_t,</span> <span class="pre">N&gt;</span></tt></td>
</tr>
</tbody>
</table>
<p>The type of std::integral_constant that <a class="reference internal" href="#typelist_index:T.Ts:" title="typelist_index&lt;T, Ts&gt;"><tt class="xref cpp cpp-class docutils literal"><span class="pre">typelist_index&lt;T,</span> <span class="pre">Ts&gt;</span></tt></a> will
inherit from depends on where <em>T</em> exists in the type list <em>Ts</em>. No attempts
are made to allow multiple <em>T*s in *Ts</em>.</p>
</dd></dl>

<dl class="class">
<dt id="type_at:N.Ts:">
<em class="property">class </em><tt class="descname">type_at&lt;N, Ts&gt;</tt><a class="headerlink" href="#type_at:N.Ts:" title="Permalink to this definition">¶</a></dt>
<dd><dl class="type">
<dt id="type_at:N.Ts:::type">
<em class="property">type </em><tt class="descname">type</tt><a class="headerlink" href="#type_at:N.Ts:::type" title="Permalink to this definition">¶</a></dt>
<dd><p>When accessed, provides the type at the index <em>N</em> in the type list <em>Ts</em></p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="value_at:N:__XCE">
<em class="property">constexpr</em> auto <tt class="descname">value_at&lt;N&gt;</tt><big>(</big><em>Ts&amp;&amp;</em><big>)</big><tt class="descclassname"> noexcept</tt><a class="headerlink" href="#value_at:N:__XCE" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The value located at the index <em>N</em> in the type list <em>Ts</em>.</td>
</tr>
<tr class="field-even field"><th class="field-name">Requires:</th><td class="field-body"><em>N</em> may not be &gt;= <tt class="docutils literal"><span class="pre">sizeof...(Ts)</span></tt></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="scope_guard:Callable:">
<em class="property">class </em><tt class="descname">scope_guard&lt;Callable&gt;</tt><a class="headerlink" href="#scope_guard:Callable:" title="Permalink to this definition">¶</a></dt>
<dd><p>Scope guard acts much like the Boost.ScopeExit library. It is non-copyable,
but movable. It can be constructed with any callable type <em>Callable</em>. The
type <em>Callable</em> must be move assignable and move constructible, and marked
as <em>noexcept</em>. <em>Callable</em> must have a function arity of 0 (that is, it takes
no arguments). It does not matter whether or not <em>Callable</em> returns a value,
as it will be ignored. To easily construct a scope_guard, a function named
<a class="reference internal" href="#make_scope_guard__Callable" title="make_scope_guard"><tt class="xref cpp cpp-func docutils literal"><span class="pre">make_scope_guard()</span></tt></a> is provided for type inference. This can easily
be used to give a scope_guard a lambda. As an example:</p>
<div class="highlight-cpp"><div class="highlight"><pre><span class="kt">int</span> <span class="n">x</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">int</span> <span class="p">{</span> <span class="mi">4</span> <span class="p">}</span>
<span class="k">auto</span> <span class="n">scope_guard</span> <span class="o">=</span> <span class="n">core</span><span class="o">::</span><span class="n">make_scope_guard</span><span class="p">([</span><span class="n">x</span><span class="p">]</span> <span class="p">{</span> <span class="k">delete</span> <span class="n">x</span><span class="p">;</span> <span class="p">});</span>
</pre></div>
</div>
<dl class="function">
<dt id="scope_guard:Callable:::dismiss">
void <tt class="descname">dismiss</tt><big>(</big><big>)</big><tt class="descclassname"> noexcept</tt><a class="headerlink" href="#scope_guard:Callable:::dismiss" title="Permalink to this definition">¶</a></dt>
<dd><p>Calling dismiss on a scope_guard will result in its <em>Callable</em> never
being invoked. This can be seen as a way to <em>rollback</em> bookkeeping code.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="make_scope_guard__Callable">
 <tt class="descname">make_scope_guard</tt><big>(</big>Callable <em>callable</em><big>)</big><tt class="descclassname"> noexcept</tt><a class="headerlink" href="#make_scope_guard__Callable" title="Permalink to this definition">¶</a></dt>
<dd><p>Constructs a <a class="reference internal" href="#scope_guard:Callable:" title="scope_guard&lt;Callable&gt;"><tt class="xref cpp cpp-class docutils literal"><span class="pre">scope_guard&lt;Callable&gt;</span></tt></a> from the given <em>callable</em>.</p>
</dd></dl>

<dl class="function">
<dt id="forward__XCE">
<em class="property">constexpr</em> T&amp;&amp; <tt class="descname">forward</tt><big>(</big><em>remove_reference_t&lt;T&gt;&amp;&amp;</em><big>)</big><tt class="descclassname"> noexcept</tt><a class="headerlink" href="#forward__XCE" title="Permalink to this definition">¶</a></dt>
<dt>
<em class="property">constexpr</em> T&amp;&amp; <tt class="descname">forward</tt><big>(</big><em>remove_reference_t&lt;T&gt;&amp;</em><big>)</big><tt class="descclassname"> noexcept</tt></dt>
<dd><p><tt class="docutils literal"><span class="pre">constexpr</span></tt> versions of <tt class="docutils literal"><span class="pre">std::forward</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="move__XCE">
<em class="property">constexpr</em> remove_reference_t&lt;T&gt;&amp;&amp; <tt class="descname">move</tt><big>(</big><em>T&amp;&amp;</em><big>)</big><tt class="descclassname"> noexcept</tt><a class="headerlink" href="#move__XCE" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">constexpr</span></tt> version of <tt class="docutils literal"><span class="pre">std::move</span></tt>.</p>
</dd></dl>

</div>


          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="memory.html" class="btn btn-neutral float-right" title="Memory Component"/>Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="variant.html" class="btn btn-neutral" title="Variant Component"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2013 - 2014, MNMLSTC.
    </p>
  </div>

  <a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
</footer>
        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'1.1',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>